package cn.disicn.util;

import java.util.List;

/**
 * @author Luyao
 * @date 2017年11月27日 下午5:45:14
 * @desc:分页类，方便返回VO
 */
public class PageSource<T> {

	/**
	 * @param pageNumber
	 * @param pageSize
	 * @param totalPage
	 * @param totalRow
	 * @param list
	 */
	public PageSource(Integer pageNumber, Integer pageSize, Integer totalPage,
			Integer totalRow, List<T> list) {
		super();
		this.pageNumber = pageNumber;
		this.pageSize = pageSize;
		if (totalPage != null)
			this.totalPage = totalPage;
		else
			this.totalPage = totalRow % pageSize == 0 ? totalRow / pageSize
					: totalRow / pageSize + 1;
		this.totalRow = totalRow;
		this.list = list;
	}

	private Integer pageNumber;

	private Integer pageSize;

	private Integer totalPage;

	private Integer totalRow;

	private List<T> list;

	/**
	 * @return the pageNumber
	 */
	public Integer getPageNumber() {
		return pageNumber;
	}

	/**
	 * @param pageNumber
	 *            the pageNumber to set
	 */
	public void setPageNumber(Integer pageNumber) {
		this.pageNumber = pageNumber;
	}

	/**
	 * @return the pageSize
	 */
	public Integer getPageSize() {
		return pageSize;
	}

	/**
	 * @param pageSize
	 *            the pageSize to set
	 */
	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	/**
	 * @return the totalPage
	 */
	public Integer getTotalPage() {
		return totalPage;
	}

	/**
	 * @param totalPage
	 *            the totalPage to set
	 */
	public void setTotalPage(Integer totalPage) {
		this.totalPage = totalPage;
	}

	/**
	 * @return the totalRow
	 */
	public Integer getTotalRow() {
		return totalRow;
	}

	/**
	 * @param totalRow
	 *            the totalRow to set
	 */
	public void setTotalRow(Integer totalRow) {
		this.totalRow = totalRow;
	}

	/**
	 * @return the list
	 */
	public List<T> getList() {
		return list;
	}

	/**
	 * @param list
	 *            the list to set
	 */
	public void setList(List<T> list) {
		this.list = list;
	}

}
